package com.ruoyi.ziran.service.impl;

import java.util.Arrays;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ziran.mapper.ZrDisasterTypeMapper;
import com.ruoyi.ziran.domain.ZrDisasterType;
import com.ruoyi.ziran.service.IZrDisasterTypeService;
import com.ruoyi.common.core.text.Convert;

/**
 * 自然灾害分类Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-11-01
 */
@Service
public class ZrDisasterTypeServiceImpl extends ServiceImpl<ZrDisasterTypeMapper, ZrDisasterType> implements IZrDisasterTypeService
{

    /**
     * 查询自然灾害分类
     * 
     * @param id 自然灾害分类主键
     * @return 自然灾害分类
     */
    @Override
    public ZrDisasterType getInfoById(Long id)
    {
        return this.getById(id);
    }

    /**
     * 查询自然灾害分类列表
     * 
     * @param zrDisasterType 自然灾害分类
     * @return 自然灾害分类
     */
    @Override
    public List<ZrDisasterType> selectList(ZrDisasterType zrDisasterType)
    {
        return baseMapper.selectList(zrDisasterType);
    }

    /**
     * 新增自然灾害分类
     * 
     * @param vo
     * @return 结果
     */
    @Override
    public int insertZrDisasterType(ZrDisasterType vo)
    {
        vo.setCreateTime(DateUtils.getNowDate());
        this.save(vo);
        return 1;
    }

    /**
     * 修改自然灾害分类
     * 
     * @param zrDisasterType 自然灾害分类
     * @return 结果
     */
    @Override
    public int updateZrDisasterType(ZrDisasterType zrDisasterType)
    {
        zrDisasterType.setUpdateTime(DateUtils.getNowDate());
        this.updateById(zrDisasterType);
        return 1;
    }

    /**
     * 批量删除自然灾害分类
     * 
     * @param ids 需要删除的自然灾害分类主键
     * @return 结果
     */
    @Override
    public int deleteZrDisasterTypeByIds(String ids)
    {
        this.removeByIds(Arrays.asList(Convert.toStrArray(ids)));
        return 1;
    }

    /**
     * 删除自然灾害分类信息
     * 
     * @param id 自然灾害分类主键
     * @return 结果
     */
    @Override
    public int deleteZrDisasterTypeById(Long id)
    {
        this.removeById(id);
        return 1;
    }
}
